package com.gao.autowired.setter;

import com.gao.autowired.AllWantBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 *
 *
 * @author GaoXi
 * @date 2022/2/24 19:37
 */
@Component
public class SetterTest1 {
    private AllWantBean allWantBean;


    /**
     * setter方法必须有@Autowire才会执行装配
     * @param allWantBean
     */
    @Autowired
    public void setAllWantBean(AllWantBean allWantBean) {
        this.allWantBean = allWantBean;
    }

    @Override
    public String toString() {
        return "ConstructorTest1{" +
            "allWantBean=" + allWantBean +
            '}';
    }
}
